<?php
namespace app\admin\controller;
use think\Session;

/**
 * 
 */
class Login
{
	
	public function index(){

		return view();
	}
	public function logint(){
		$data = input('post.');
		$user = $data['user'];
		$paw = $data['paw'];
		$db = model('Admin');
		// 查询单个数据
		if(!$vm = $db->where('username',$user)->find()) 
		return array('code'=>0,'msg'=>"用户名或密码错误");
		if($vm['password'] == md5($paw)){
			cache('USER_ID',$vm['id'],60*60);//缓存有效期1小时
			return array('code'=>1,'msg'=>"登陆成功");
		}
		return array('code'=>0,'msg'=>"网络异常");
		
	}
}